Repository navigation
Add non-blocking TX primitives: tx_fifo_full and try_putchar - #2
Merged
Merged
Conversation
putchar polls FR[TXFF] forever, which is unusable in contexts that must bound their waiting (interrupt handlers, NMI/emergency console output, panic paths). Expose the polling condition and a non-blocking variant: - tx_fifo_full(): read FR[TXFF] directly; - try_putchar(): write DR only when the TX FIFO has space, reporting success/failure instead of blocking. putchar is now a loop over try_putchar, so its behavior is unchanged. Host unit tests exercise both paths against a simulated register block. Motivation: the x-kernel emergency console (NMI-safe printk) needs a bounded UART send on PL011; with this API it can reuse the crate instead of open-coding FR/DR volatile accesses. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Import or qualify size_of in the test module to resolve the compilation failures.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds non-blocking PL011 transmit helpers while preserving putchar’s blocking behavior.
Changes:
- Adds
tx_fifo_full()andtry_putchar(). - Refactors
putchar()to reusetry_putchar(). - Adds simulated-register unit tests.
File summaries
| File | Summary |
|---|---|
src/pl011.rs |
Implements TX helpers and tests; test code has unresolved size_of references. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+127
to
+128
| use super::*; | ||
|
|
equation314
approved these changes
Sep 11, 2026
luodeb
added a commit
that referenced
this pull request
Sep 14, 2026
For the non-blocking TX primitives added in #2 (tx_fifo_full, try_putchar). via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@/tmp/pr2-body.md